// js  单线程 event loop  异步多任务，不支持sleep

let fun = () => console.log('time out')
let sleep = function(fun, time) {
    setTimeout(() => {
        fun();
    }, time)
}

sleep(fun, 2000)